PTCommandTSPL Class Reference

Inherits from NSObject
Declared in PTCommandTSPL.h

Overview

TSC-TSPL 指令集:大约62个生成指令的函数

– initCMDQueue

initialize command queue. 初始化指令队列

- (void)initCMDQueue

Declared In

PTCommandTSPL.h

– generateCMDQueue

generate command queue 生成指令

- (NSArray *)generateCMDQueue

Return Value

command queue

Declared In

PTCommandTSPL.h

– addBitmapDataToCMDQueue:

add image data to command queue 将生成的位图数据加入打印队列

- (void)addBitmapDataToCMDQueue:(NSData *)data

Declared In

PTCommandTSPL.h

– selfTest

printer print self-test message. 自检,打印打印机信息

- (void)selfTest

Declared In

PTCommandTSPL.h

– setPrintAreaSizeWithWidth:Height:

setting print area size in paper. 打印纸张范围大小

- (void)setPrintAreaSizeWithWidth:(NSString *)label_width Height:(NSString *)label_height

Declared In

PTCommandTSPL.h

– setGapWithDistance:Offset:

setting gap distance during labels. 设置标签纸的间距

- (void)setGapWithDistance:(NSString *)distance Offset:(NSString *)offset

Parameters

distance

两张标签紙中间的垂直距离

offset

垂直间距的偏移

Declared In

PTCommandTSPL.h

– setBlineWithHeight:Offset:

setting black line 设置黑线

- (void)setBlineWithHeight:(NSString *)height Offset:(NSString *)offset

Parameters

height

黑线的高度 0~25.4 mm

offset

黑线偏移量 0~label length height,offset 为0,0表示连续标签

Declared In

PTCommandTSPL.h

– setOffsetWithDistance:

paper feed with distance. 走纸

- (void)setOffsetWithDistance:(NSString *)distance

Declared In

PTCommandTSPL.h

– printWithSets:Copies:

setting print sets and copies. 打印数量

- (void)printWithSets:(NSString *)sets Copies:(NSString *)copies

Parameters

sets

多少份 how many sets of labels will be printed.

copies

每份多少张 how many copies should be printed for each particular label set.

Declared In

PTCommandTSPL.h

– printTexTWithXPos:YPos:Font:Rotation:XMultiplication:YMultiplication:Text:

print text. 打印文本

- (void)printTexTWithXPos:(NSString *)x_pos YPos:(NSString *)y_pos Font:(NSString *)font Rotation:(NSString *)rotation XMultiplication:(NSString *)x_multiplication YMultiplication:(NSString *)y_multiplication Text:(NSString *)text

Declared In

PTCommandTSPL.h

– setCLS

clean printer buffer. 清除打印机缓冲区

- (void)setCLS

Declared In

PTCommandTSPL.h

– printBarcodeWithXPos:YPos:Type:Height:HumanReadable:Rotation:Narrow:Wide:CodeNumber:

print barcode. 打印一维条码

- (void)printBarcodeWithXPos:(NSString *)x_pos YPos:(NSString *)y_pos Type:(NSString *)type Height:(NSString *)height HumanReadable:(NSString *)readable Rotation:(NSString *)rotation Narrow:(NSString *)narrow Wide:(NSString *)wide CodeNumber:(NSString *)codeNumber

Parameters

type

条码类型 @[128,128M,EAN128,25,25C,39,29S,93,EAN13,EAN13+2,EAN13+5,EAN8,EAN8+5,CODA,POST,UPCA,UPCA+2,UPCA+5,UPCE,UPCE+2,UPCE+5,CPOST,MSI,MSIC,PLESSEY,ITF14,EAN14,11];

readable

是否可读:0,不可读,1,可读

rotation

旋转:0,90,180,270

narrow

窄元素

wide

宽元素

Declared In

PTCommandTSPL.h

– printQRcodeWithXPos:YPos:EccLevel:CellWidth:Mode:Rotation:Model:Mask:Text:

print QRCode 打印二维条码

- (void)printQRcodeWithXPos:(NSString *)x_pos YPos:(NSString *)y_pos EccLevel:(NSString *)ecc_level CellWidth:(NSString *)width Mode:(NSString *)mode Rotation:(NSString *)rotation Model:(NSString *)model Mask:(NSString *)mask Text:(NSString *)text

Declared In

PTCommandTSPL.h

– printBitmapWithXPos:YPos:Width:Height:Mode:

print Bitmap 打印位图

- (void)printBitmapWithXPos:(NSString *)x_pos YPos:(NSString *)y_pos Width:(NSString *)width Height:(NSString *)height Mode:(NSString *)mode

Parameters

mode

位图模式:(0:OVERWRITE 1:OR 2:XOR)

data

Bitmap data

Declared In

PTCommandTSPL.h

– setSpeed:

setting print speed 设置打印速度

- (void)setSpeed:(NSString *)speed

Declared In

PTCommandTSPL.h

– setDensity:

setting print density 设置打印浓度

- (void)setDensity:(NSString *)density

Parameters

density

浓度 0~15 level

Declared In

PTCommandTSPL.h

– setDirection:Mirror:

setting print direction and mirror. 设置打印的方向和镜像

- (void)setDirection:(NSString *)direction Mirror:(NSString *)mirror

Parameters

direction

方向,面对打印机,向自己方向出纸,0,左上角,1,右下角

mirror

镜像,可选项 0 普通,1 镜像

Declared In

PTCommandTSPL.h

– setReferenceXPos:YPos:

setting print reference position 设置标签参考起点

- (void)setReferenceXPos:(NSString *)x_pos YPos:(NSString *)y_pos

Declared In

PTCommandTSPL.h

– setCodePage:

  • page 18.
  • setting the code page of inernational character set.设置国际字符集 7-bit code page name: USA: USA BRI: British GER: German FRE: French DAN: Danish ITA: Italian SPA: Spanish SWE: Swedish SWI: Swiss
- (void)setCodePage:(NSString *)codepage

Discussion

8-bit code page number: 437: United States 850: Multilingual 852: Slavic 860: Portuguese 863: Canadian/French 865: Nordic 857: Turkish (TSPL2 printers only)

Windows code page: 1250: Central Europe (TSPL2 printers only) 1252: Latin I (TSPL2 printers only) 1253: Greek (TSPL2 printers only) 1254: Turkish (TSPL2 printers only) * * @param codepage 字符集代码

Declared In

PTCommandTSPL.h

– setFeedLength:

page 21. feed label with the specified length.设置标签进纸长度

- (void)setFeedLength:(NSString *)feedLength

Parameters

feedLength

(1~9999)

Declared In

PTCommandTSPL.h

– setFormFeed

feed label to the beginning of next label.设置进纸到下一标签起始处

- (void)setFormFeed

Declared In

PTCommandTSPL.h

– setHome

page 25. feed label until the internal sensor has determined the origin.设置标签定位到内部传感器确定的起点

- (void)setHome

Declared In

PTCommandTSPL.h

– setSoundWithLevel:Interval:

page 28. control the sound frequency of the beeper.设置蜂鸣

- (void)setSoundWithLevel:(NSString *)level Interval:(NSString *)interval

Parameters

level

0-9

interval

1-4095

Declared In

PTCommandTSPL.h

– setCut

page 29. activate the cutter to immediately cut the labels without back feeding the label.设置切纸

- (void)setCut

Declared In

PTCommandTSPL.h

– setLimitFeed:

page 30. 设置停止送纸

- (void)setLimitFeed:(NSString *)max_len

Declared In

PTCommandTSPL.h

– printBarWithXPos:YPos:Width:Height:

page 32. draw a bar on the label format.在标签上画一条线

- (void)printBarWithXPos:(NSString *)x_pos YPos:(NSString *)y_pos Width:(NSString *)width Height:(NSString *)height

Declared In

PTCommandTSPL.h

– setBoxWithXStart:YStart:XEnd:YEnd:Thickness:

page 39. draw rectangles on the label.在标签上绘制矩形

- (void)setBoxWithXStart:(NSString *)x_start YStart:(NSString *)y_start XEnd:(NSString *)x_end YEnd:(NSString *)y_end Thickness:(NSString *)thickness

Parameters

thickness

线宽

Declared In

PTCommandTSPL.h

– setCircleWithXStart:YStart:Diameter:Thickness:

page 41. draw a circle on the label.在标签上绘制圆形

- (void)setCircleWithXStart:(NSString *)x_start YStart:(NSString *)y_start Diameter:(NSString *)diameter Thickness:(NSString *)thickness

Parameters

diameter

直径

thickness

线宽

Declared In

PTCommandTSPL.h

– setEraseWithXStart:YStart:XWidth:YHeight:

page 43. clear a specified region in the image buffer.擦除图像缓冲区指定的区域

- (void)setEraseWithXStart:(NSString *)x_start YStart:(NSString *)y_start XWidth:(NSString *)x_width YHeight:(NSString *)y_height

Declared In

PTCommandTSPL.h

– setDmatrixWithExpression:XPos:YPos:Width:Height:XM:Row:Col:

page 42. define the DataMatrix 2D bar code.Currently,only ECC200 error correction is supported. 设置 DataMatrix 二维码,当前仅支持 ECC200 错误纠正

- (void)setDmatrixWithExpression:(NSString *)expression XPos:(NSString *)x_pos YPos:(NSString *)y_pos Width:(NSString *)width Height:(NSString *)height XM:(NSString *)xm Row:(NSString *)row Col:(NSString *)col

Parameters

expression

表达式

xm

[可选],Module size,x6,x8

row

[可选],范围:10-144

col

[可选],范围:10-144

Declared In

PTCommandTSPL.h

– setMaxicode:XPos:YPos:Mode:Class:Country:Post:LM:

  • page 44.
  • define a 2D Maxicode.打印 Maxicode 二维码 *
  • @param mode 2,3,4,5
  • @param class [option],Class of Service ,3-digit number(for mode 2,3)
  • @param country [option],Country code, 3-digit number (for mode 2,3)
  • @param post [option], Mode 2: (USA) 5-digit+ 4-digit number. Mode 3: (Canada) 6 alphanumeric post code included by double quotes.
  • @param lm Expression length (double quote is ignored) , 范围:1-138, (this parameter is just for mode 4 and 5.)
- (void)setMaxicode:(NSString *)text XPos:(NSString *)x_pos YPos:(NSString *)y_pos Mode:(NSString *)mode Class:(NSString *)iClass Country:(NSString *)country Post:(NSString *)post LM:(NSString *)lm

Declared In

PTCommandTSPL.h

– printPDF417WithXPos:YPos:Width:Height:Rotate:Option:Expression:

* * page 46. * define a PDF417 2D barcode.

- (void)printPDF417WithXPos:(NSString *)x_pos YPos:(NSString *)y_pos Width:(NSString *)width Height:(NSString *)height Rotate:(NSString *)rotate Option:(NSString *)option Expression:(NSString *)expression

Discussion

[Option]

P Data compression method 0: Auto encoding 1: Binary mode

E Error correction level. Range: 0~8 Center pattern in barcode area 0: The pattern will print upper left justified the area 1: The pattern is printed middle of area

Ux,y,c Human readable x: Human readable characters in the specified x-coordinate y: Human readable characters in the specified y-coordinate c: Maximum characters of human readable character per line

W Module width in dot. Range: 2~9 H Bar height in dot. Range: 4~99 R Maximum number of rows C Maximum number of columns T Truncation. 0: Not truncated 1: Truncated

  • @param option 可选项

Declared In

PTCommandTSPL.h

– putBMPWithFilename:XPos:YPos:

page 52. print Bitmap format image.

- (void)putBMPWithFilename:(NSString *)filename XPos:(NSString *)x_pos YPos:(NSString *)y_pos

Declared In

PTCommandTSPL.h

– putPCXWithFilename:XPos:YPos:

page 54. print PCX format images.

- (void)putPCXWithFilename:(NSString *)filename XPos:(NSString *)x_pos YPos:(NSString *)y_pos

Declared In

PTCommandTSPL.h

– setReverseWithXStart:YStart:XWidth:YHeight:

page 63. reverse a region in image buffer.

- (void)setReverseWithXStart:(NSString *)x_start YStart:(NSString *)y_start XWidth:(NSString *)x_width YHeight:(NSString *)y_height

Declared In

PTCommandTSPL.h

– setCounterWithCounterNumber:Step:

page 32. setting the counter number in the program and its increments.计数器设置

- (void)setCounterWithCounterNumber:(NSString *)counterNumber Step:(NSString *)step

Parameters

counterNumber

第几个计数器 (0-50)

step

计数间隔 (-99999999 ~ 99999999)

Declared In

PTCommandTSPL.h

– setCutterPieces:

set number of printing labels per cut

- (void)setCutterPieces:(NSString *)pieces

Parameters

pieces

(0 ~ 65535)

Declared In

PTCommandTSPL.h

– setPARTIAL_CUTTER_Pieces:

set number of printing labels per cut

- (void)setPARTIAL_CUTTER_Pieces:(NSString *)pieces

Parameters

pieces

(0 ~ 65535)

Declared In

PTCommandTSPL.h

– setKEY:Switch:

This setting is used to enable/disable the KEY1/KEY2/KEY3 function.

- (void)setKEY:(int)index Switch:(NSString *)switcher

Parameters

index

KEY1,KEY2,KEY3

switcher

ON/OFF

Declared In

PTCommandTSPL.h

– setLED:Switch:

  • This setting is used to enable/disable the LED function. LED1 Power on/off LED2 Printer on-line/off-line LED3 Error/normal *
  • @param index LED1,LED2,LED3
  • @param switcher ON/OFF
- (void)setLED:(int)index Switch:(NSString *)switcher

Declared In

PTCommandTSPL.h

– setTearON

This command is used to enable/disable feeding of labels to gap/black mark position for tearing off. This setting will be saved in printer memory when turning off the power.

- (void)setTearON

Declared In

PTCommandTSPL.h

– setHeadON

This setting is used to enable/disable head open sensor.

- (void)setHeadON

Declared In

PTCommandTSPL.h

– setCOM1WithBaud:Parity:Data:Stop:

This setting defines communication parameters for printer serial port.

- (void)setCOM1WithBaud:(NSString *)baud Parity:(NSString *)parity Data:(NSString *)data Stop:(NSString *)stop

Parameters

baud

24,48,96,19,38,57,115( 对应单位2400 bps,4800 bps,9600 bps,38400 bps,15200 bps)

parity

N,E,O(NO/Even/Odd parity check)

data

7,8(bits Data)

stop

1,2(stop bit)

Declared In

PTCommandTSPL.h

– setPrintKey:

This command will print one label and feed label gap to tear br position for tearing away. This setting will be saved in printer memory.

- (void)setPrintKey:(NSString *)key

Parameters

key

OFF/ON/AUTO/

Declared In

PTCommandTSPL.h